package com.wangdong.wdutils.engine;

import android.annotation.SuppressLint;
import android.app.Application;

import com.wangdong.wdutils.utils.DLLogUtil;


/**
 * Created by luyz on 2017/7/17.
 * 工具类engine
 */

public class XTUtilsEngine {

    private Application application;

    @SuppressLint("StaticFieldLeak")
    private static XTUtilsEngine instance;
    private boolean debug = false;

    private XTUtilsEngine(){

    }

    public void init(Application mApp){
        application = mApp;
    }

    public Application getUtilsApp(){
        return application;
    }

    public boolean isDebug() {
        return debug;
    }

    protected static XTUtilsEngine newInstance(){
        return new XTUtilsEngine();
    }

    public static XTUtilsEngine getInstance() {

        if (instance == null) {
            synchronized (XTUtilsEngine.class) {
                if (instance == null) {
                    instance = newInstance();
                }
            }
        }
        return instance;
    }

    public void setDebug(boolean debug) {
        this.debug = debug;
        DLLogUtil.setDebug(debug);
    }

    public void setWriteLogToFile(boolean writeLogToFile) {

        DLLogUtil.setWriteLogToFile(writeLogToFile);
    }
}
